﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Heavy_Metals
{
    public partial class EmgPlanAndCountermeasuresForm : Form
    {
        public EmgPlanAndCountermeasuresForm()
        {
            InitializeComponent();
            this.dataGridView1.Rows.Add();
            this.dataGridView1.Rows[0].Cells[0].Value = "预案1";
            this.dataGridView1.Rows[0].Cells[1].Value = "备注1";
            this.dataGridView1.Rows[0].Cells[2].Value = "下载";
            this.dataGridView1.Rows[0].Cells[3].Value = "查看";
            this.dataGridView1.Rows[0].Cells[4].Value = "删除";
            this.dataGridView1.Rows.Add();
            this.dataGridView1.Rows[1].Cells[0].Value = "预案2";
            this.dataGridView1.Rows[1].Cells[1].Value = "备注2";
            this.dataGridView1.Rows[1].Cells[2].Value = "下载";
            this.dataGridView1.Rows[1].Cells[3].Value = "查看";
            this.dataGridView1.Rows[1].Cells[4].Value = "删除";
            this.dataGridView1.Rows.Add();
            this.dataGridView1.Rows[2].Cells[0].Value = "预案3";
            this.dataGridView1.Rows[2].Cells[1].Value = "备注3";
            this.dataGridView1.Rows[2].Cells[2].Value = "下载";
            this.dataGridView1.Rows[2].Cells[3].Value = "查看";
            this.dataGridView1.Rows[2].Cells[4].Value = "删除";

            this.dataGridView2.Rows.Add();
            this.dataGridView2.Rows[0].Cells[0].Value = "预案1";
            this.dataGridView2.Rows[0].Cells[1].Value = "备注1";
            this.dataGridView2.Rows[0].Cells[2].Value = "下载";
            this.dataGridView2.Rows[0].Cells[3].Value = "查看";
            this.dataGridView2.Rows[0].Cells[4].Value = "删除";
            this.dataGridView2.Rows.Add();
            this.dataGridView2.Rows[1].Cells[0].Value = "预案2";
            this.dataGridView2.Rows[1].Cells[1].Value = "备注2";
            this.dataGridView2.Rows[1].Cells[2].Value = "下载";
            this.dataGridView2.Rows[1].Cells[3].Value = "查看";
            this.dataGridView2.Rows[1].Cells[4].Value = "删除";
            this.dataGridView2.Rows.Add();
            this.dataGridView2.Rows[2].Cells[0].Value = "预案3";
            this.dataGridView2.Rows[2].Cells[1].Value = "备注3";
            this.dataGridView2.Rows[2].Cells[2].Value = "下载";
            this.dataGridView2.Rows[2].Cells[3].Value = "查看";
            this.dataGridView2.Rows[2].Cells[4].Value = "删除";

            this.dataGridView3.Rows.Add();
            this.dataGridView3.Rows[0].Cells[0].Value = "预案1";
            this.dataGridView3.Rows[0].Cells[1].Value = "备注1";
            this.dataGridView3.Rows[0].Cells[2].Value = "下载";
            this.dataGridView3.Rows[0].Cells[3].Value = "查看";
            this.dataGridView3.Rows[0].Cells[4].Value = "删除";
            this.dataGridView3.Rows.Add();
            this.dataGridView3.Rows[1].Cells[0].Value = "预案2";
            this.dataGridView3.Rows[1].Cells[1].Value = "备注2";
            this.dataGridView3.Rows[1].Cells[2].Value = "下载";
            this.dataGridView3.Rows[1].Cells[3].Value = "查看";
            this.dataGridView3.Rows[1].Cells[4].Value = "删除";
            this.dataGridView3.Rows.Add();
            this.dataGridView3.Rows[2].Cells[0].Value = "预案3";
            this.dataGridView3.Rows[2].Cells[1].Value = "备注3";
            this.dataGridView3.Rows[2].Cells[2].Value = "下载";
            this.dataGridView3.Rows[2].Cells[3].Value = "查看";
            this.dataGridView3.Rows[2].Cells[4].Value = "删除";

            this.dataGridView4.Rows.Add();
            this.dataGridView4.Rows[0].Cells[0].Value = "预案1";
            this.dataGridView4.Rows[0].Cells[1].Value = "备注1";
            this.dataGridView4.Rows[0].Cells[2].Value = "下载";
            this.dataGridView4.Rows[0].Cells[3].Value = "查看";
            this.dataGridView4.Rows[0].Cells[4].Value = "删除";
            this.dataGridView4.Rows.Add();
            this.dataGridView4.Rows[1].Cells[0].Value = "预案2";
            this.dataGridView4.Rows[1].Cells[1].Value = "备注2";
            this.dataGridView4.Rows[1].Cells[2].Value = "下载";
            this.dataGridView4.Rows[1].Cells[3].Value = "查看";
            this.dataGridView4.Rows[1].Cells[4].Value = "删除";
            this.dataGridView4.Rows.Add();
            this.dataGridView4.Rows[2].Cells[0].Value = "预案3";
            this.dataGridView4.Rows[2].Cells[1].Value = "备注3";
            this.dataGridView4.Rows[2].Cells[2].Value = "下载";
            this.dataGridView4.Rows[2].Cells[3].Value = "查看";
            this.dataGridView4.Rows[2].Cells[4].Value = "删除";
        }

        private void tabPage1_Click(object sender, EventArgs e)
        {

        }

        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == 4)
            {
                DialogResult response = MessageBox.Show("您确定要删除？", "请确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
                if (response == System.Windows.Forms.DialogResult.Yes)
                {
                    this.dataGridView1.Rows.RemoveAt(e.RowIndex);
                }
            }
            if (e.ColumnIndex == 3)
            {
                PlanCheckForm cInfo = new PlanCheckForm();
                
                cInfo.Show();
            }
            else if (e.ColumnIndex == 2)
            {
                SaveFileDialog saveFileDialog = new SaveFileDialog();
                saveFileDialog.Filter = "文本文件|*.*|*.txt|*.cs|所有文件|*.*";
                saveFileDialog.FilterIndex = 2;
                saveFileDialog.RestoreDirectory = true;
                if (saveFileDialog.ShowDialog() == DialogResult.OK)
                {
                    
                }
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();
            openFileDialog.InitialDirectory = "c:\\";//注意这里写路径时要用c:\\而不是c:\
            openFileDialog.Filter = "文本文件|*.*|C#文件|*.cs|所有文件|*.*";
            openFileDialog.RestoreDirectory = true;
            openFileDialog.FilterIndex = 1;
            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                this.textBox3.Text = openFileDialog.FileName;
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            int newRowNum = this.dataGridView1.Rows.Count - 1;
            this.dataGridView1.Rows.Add();
            this.dataGridView1.Rows[newRowNum].Cells[0].Value = this.textBox1.Text;
            this.dataGridView1.Rows[newRowNum].Cells[1].Value = this.textBox2.Text;
            this.dataGridView1.Rows[newRowNum].Cells[2].Value = "下载";
            this.dataGridView1.Rows[newRowNum].Cells[3].Value = "查看";
            this.dataGridView1.Rows[newRowNum].Cells[4].Value = "删除";
        }

        private void button4_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();
            openFileDialog.InitialDirectory = "c:\\";//注意这里写路径时要用c:\\而不是c:\
            openFileDialog.Filter = "文本文件|*.*|C#文件|*.cs|所有文件|*.*";
            openFileDialog.RestoreDirectory = true;
            openFileDialog.FilterIndex = 1;
            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                this.textBox4.Text = openFileDialog.FileName;
            }
        }

        private void button3_Click(object sender, EventArgs e)
        {
            int newRowNum = this.dataGridView2.Rows.Count - 1;
            this.dataGridView2.Rows.Add();
            this.dataGridView2.Rows[newRowNum].Cells[0].Value = this.textBox6.Text;
            this.dataGridView2.Rows[newRowNum].Cells[1].Value = this.textBox5.Text;
            this.dataGridView2.Rows[newRowNum].Cells[2].Value = "下载";
            this.dataGridView2.Rows[newRowNum].Cells[3].Value = "查看";
            this.dataGridView2.Rows[newRowNum].Cells[4].Value = "删除";
        }

        private void button6_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();
            openFileDialog.InitialDirectory = "c:\\";//注意这里写路径时要用c:\\而不是c:\
            openFileDialog.Filter = "文本文件|*.*|C#文件|*.cs|所有文件|*.*";
            openFileDialog.RestoreDirectory = true;
            openFileDialog.FilterIndex = 1;
            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                this.textBox7.Text = openFileDialog.FileName;
            }
        }

        private void button5_Click(object sender, EventArgs e)
        {
            int newRowNum = this.dataGridView3.Rows.Count - 1;
            this.dataGridView3.Rows.Add();
            this.dataGridView3.Rows[newRowNum].Cells[0].Value = this.textBox9.Text;
            this.dataGridView3.Rows[newRowNum].Cells[1].Value = this.textBox8.Text;
            this.dataGridView3.Rows[newRowNum].Cells[2].Value = "下载";
            this.dataGridView3.Rows[newRowNum].Cells[3].Value = "查看";
            this.dataGridView3.Rows[newRowNum].Cells[4].Value = "删除";
        }

        private void button8_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();
            openFileDialog.InitialDirectory = "c:\\";//注意这里写路径时要用c:\\而不是c:\
            openFileDialog.Filter = "文本文件|*.*|C#文件|*.cs|所有文件|*.*";
            openFileDialog.RestoreDirectory = true;
            openFileDialog.FilterIndex = 1;
            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                this.textBox10.Text = openFileDialog.FileName;
            }
        }

        private void button7_Click(object sender, EventArgs e)
        {
            int newRowNum = this.dataGridView4.Rows.Count - 1;
            this.dataGridView4.Rows.Add();
            this.dataGridView4.Rows[newRowNum].Cells[0].Value = this.textBox12.Text;
            this.dataGridView4.Rows[newRowNum].Cells[1].Value = this.textBox11.Text;
            this.dataGridView4.Rows[newRowNum].Cells[2].Value = "下载";
            this.dataGridView4.Rows[newRowNum].Cells[3].Value = "查看";
            this.dataGridView4.Rows[newRowNum].Cells[4].Value = "删除";
        }

        private void dataGridView2_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == 4)
            {
                DialogResult response = MessageBox.Show("您确定要删除？", "请确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
                if (response == System.Windows.Forms.DialogResult.Yes)
                {
                    this.dataGridView2.Rows.RemoveAt(e.RowIndex);
                }
            }
            if (e.ColumnIndex == 3)
            {
                PlanCheckForm cInfo = new PlanCheckForm();

                cInfo.Show();
            }
            else if (e.ColumnIndex == 2)
            {
                SaveFileDialog saveFileDialog = new SaveFileDialog();
                saveFileDialog.Filter = "文本文件|*.*|*.txt|*.cs|所有文件|*.*";
                saveFileDialog.FilterIndex = 2;
                saveFileDialog.RestoreDirectory = true;
                if (saveFileDialog.ShowDialog() == DialogResult.OK)
                {

                }
            }
        }

        private void dataGridView3_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == 4)
            {
                DialogResult response = MessageBox.Show("您确定要删除？", "请确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
                if (response == System.Windows.Forms.DialogResult.Yes)
                {
                    this.dataGridView3.Rows.RemoveAt(e.RowIndex);
                }
            }
            if (e.ColumnIndex == 3)
            {
                PlanCheckForm cInfo = new PlanCheckForm();

                cInfo.Show();
            }
            else if (e.ColumnIndex == 2)
            {
                SaveFileDialog saveFileDialog = new SaveFileDialog();
                saveFileDialog.Filter = "文本文件|*.*|*.txt|*.cs|所有文件|*.*";
                saveFileDialog.FilterIndex = 2;
                saveFileDialog.RestoreDirectory = true;
                if (saveFileDialog.ShowDialog() == DialogResult.OK)
                {

                }
            }
        }

        private void dataGridView4_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == 4)
            {
                DialogResult response = MessageBox.Show("您确定要删除？", "请确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
                if (response == System.Windows.Forms.DialogResult.Yes)
                {
                    this.dataGridView4.Rows.RemoveAt(e.RowIndex);
                }
            }
            if (e.ColumnIndex == 3)
            {
                PlanCheckForm cInfo = new PlanCheckForm();

                cInfo.Show();
            }
            else if (e.ColumnIndex == 2)
            {
                SaveFileDialog saveFileDialog = new SaveFileDialog();
                saveFileDialog.Filter = "文本文件|*.*|*.txt|*.cs|所有文件|*.*";
                saveFileDialog.FilterIndex = 2;
                saveFileDialog.RestoreDirectory = true;
                if (saveFileDialog.ShowDialog() == DialogResult.OK)
                {

                }
            }
        }
    }
}
